package com.xmy.cultivate.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.xmy.cultivate.entity.EnrollInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * 招生数据 Mapper 接口
 * </p>
 *
 * @author hpiggy
 * @since 2024-03-20
 */
public interface EnrollInfoMapper extends BaseMapper<EnrollInfo> {

    @Update("update enroll_info set deleted= ${deleted} where id = ${id} ")
    public Integer updateDeleted(@Param("id") Long id, @Param("deleted") Integer deleted);

    @Select("select * from (select t1.*,t2.year_part,t2.quarter_num from enroll_info as t1 LEFT JOIN order_apply as t2 on t1.order_id = t2.id and t1.deleted=0 and t2.status<>2) as t ${ew.customSqlSegment}")
    public abstract List<EnrollInfo> getEnrollInfoList(@Param(Constants.WRAPPER) Wrapper wrapper);
}
